//
//  SNBaseSubViewController.m
//  project
//
//  Created by 黄建华 on 2017/12/6.
//  Copyright © 2017年 黄建华. All rights reserved.
//

#import "SNBaseSubViewController.h"

@interface SNBaseSubViewController ()

@end

@implementation SNBaseSubViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = BBIGLIGHTCOLOR;
    
    UIView *stateView = [[UIView alloc] init];
    stateView.backgroundColor = BBIGSTATECOLOR;
    if (KK_ShareData.ipx)
    {
        stateView.frame = SNFRAME(0, 0, HHHWIDTH, 40);
    }
    else
    {
        stateView.frame = SNFRAME(0, 0, HHHWIDTH, 20);
    }
    [self.view addSubview:stateView];
    
    _sbTitleLable = [[UILabel alloc] init];
    _sbTitleLable.textAlignment = NSTextAlignmentCenter;
    _sbTitleLable.frame = SNFRAME(0, FitSimpleIpx(32, 52), HHHWIDTH, 20);
//    _sbTitleLable.text = @"导航";
    _sbTitleLable.textColor = SNCOLORBLACK;
    _sbTitleLable.font = SNFONT(17.0);
    [self.view addSubview:_sbTitleLable];
    
    _leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _leftButton.frame = SNFRAME(5, FitSimpleIpx(0, 20), 44, 44);
    //    [_leftButton  setImageNormal:@"进入"];
    [_leftButton setTitleColor:SNCOLORBLACK forState:UIControlStateNormal];
    _leftButton.titleLabel.font = SNSFONT(15.0);
    _leftButton.center = CGPointMake(25, _sbTitleLable.center.y);
    [_leftButton  addTarget:self
                     action:@selector(functionSetLeft)
           forControlEvents:UIControlEventTouchUpInside];
    _leftButton.hidden = YES;
    [self.view addSubview:_leftButton];
    
    _rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _rightButton.frame = SNFRAME(5, FitSimpleIpx(0, 20), 60, 44);
    //    [_leftButton  setImageNormal:@"进入"];
    [_rightButton setTitleColor:SNCOLORBLACK forState:UIControlStateNormal];
    _rightButton.titleLabel.font = SNSFONT(15.0);
    _rightButton.center = CGPointMake(HHHWIDTH - _rightButton.width /2, _sbTitleLable.center.y);
    [_rightButton  addTarget:self
                      action:@selector(functionSetRight)
            forControlEvents:UIControlEventTouchUpInside];
    _rightButton.hidden = YES;
    [self.view addSubview:_rightButton];
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(SNBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(SNBebackground) name:UIApplicationDidEnterBackgroundNotification object:nil];
}

- (void)SNBecomeActive
{
    
}

- (void)SNBebackground
{
    
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
}

- (void)functionSetLeft
{
    
}

- (void)functionSetRight
{
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    CustomTabBar *tabBar = (CustomTabBar *)self.tabBarController;
    [tabBar hiddenTheTabBarView];

    KK_BLEConnect.updateModelStatus = ^(KKBLEModel *model, KKBLEUpdateType type)
    {
        [self updateModel:model type:type];
    };
    
    KK_BLEConnect.bleConnectAcceptBlock = ^(id object, KKBLEAcceptType type) {
        [self updateView:type];
    };
}

// 通知界面蓝牙状态
- (void)updateModel:(KKBLEModel *)model type:(KKBLEUpdateType)type
{
    
}

// 通知界面接收数据刷新相应界面的UI UpdateUiType
- (void)updateView:(KKBLEAcceptType)type
{

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
